$.fn.inputer = function (o, p) {
    var obj = this;
    jQuery.each(obj, function (i, obj_sub) {
        var inputerId = "_inputer" + obj_sub.id;

        var iset = $("input[id=" + obj_sub.id + "]").offset();
        $("input[id=" + obj_sub.id + "]").after("<select id=\"" + inputerId + "\" name=\"" + inputerId + "\"></select>");

        //IE和FF有一点点区别
        $("select[id=" + inputerId + "]").width($(obj_sub).width() + ($.browser.msie ? 6 : 4) + "px");
        
        $("select[id=" + inputerId + "]").css({ position: "absolute",
            display: "none",
            left: function () { return iset.left; },
            top: function () { return $.browser.msie ? iset.top : iset.top + 1 + "px" },
            clip: "rect(1px " + ($("select[id=" + inputerId + "]").width() + ($.browser.msie ? 6 : 8) + "px") + " " + ($("select[id=" + inputerId + "]").height() + ($.browser.msie ? 1 : 2) + "px") + " " + ($("select[id=" + inputerId + "]").width() - 15 + "px") + ")",
            "font-size": obj.css("font-size")
        });

        var option = "<option value=''></option>";

        if (p != null && p.textField != null && p.valueField != null) {
            $.each(o, function (ovar, opt) {
                option += '<option value=' + opt[p.valueField] + '>' + opt[p.textField] + '</option>';
            });
        } else {
            $.each(o, function (ovar, opt) {
                //数组则列表值用数组元素而不是索引
                option += '<option value=' + (o.length ? opt : ovar) + '>' + opt + '</option>';
            });
        }

        //先清空一下,防止内容叠加
        $("select[id=" + inputerId + "]").empty()
		.append(option)
		.css({ display: "block" })
		.change(function () {
		    $("input[id=" + obj_sub.id + "]").val($("option:selected", this).val())
			.change();
		});
    });
};